<?php

namespace app\admin\controller\store;

use app\common\controller\AdminController;
use app\common\service\store\SeckillConfigService;
use app\common\service\store\SeckillService;
use app\Request;
use EasyAdmin\annotation\ControllerAnnotation;
use EasyAdmin\annotation\NodeAnotation;
use think\App;
use think\facade\View;

/**
 * @ControllerAnnotation(title="seckill")
 */
class Seckill extends AdminController
{

    use \app\admin\traits\Curd;

    public function __construct(App $app)
    {
        parent::__construct($app);

        $this->model = new \app\admin\model\store\Seckill();

    }

    /**
     * 下拉选择商品
     * @return \think\response\Json
     */
    public function goods()
    {
        $data = SeckillService::goods();
        return json($data);
    }

    /**
     * 下拉选择秒杀配置
     * @return \think\response\Json
     */
    public function seckillConfigs()
    {
        $data = SeckillService::seckillConfigs();
        return $this->success('成功',$data);
    }

    public function chooseGood(Request $request)
    {
        $id = $request->get('id');
        $data = SeckillService::good($id);
        return $this->success('成功',$data);
    }

    public function chooseConfig(Request $request)
    {
        $id = $request->get('id');
        $data = SeckillConfigService::idFind($id);
        return $this->success('成功',$data);
    }


}